#include <QThread>
#include <QFileInfo>

#include "XCompareParam.h"
#include "XCompareRunnable.h"


XCompareRunnable::XCompareRunnable(const QString& strLeft, const QString& strRight, XTaskPtr task, QObject* p)
	:QObject(p),m_task(task),m_strLeft(strLeft),m_strRight(strRight)
{

}


void XCompareRunnable::SetCompairDir(QString strLeft, QString strRight)
{
	//QMutexLocker m(&m_mutex);
	m_compair.m_strLeft = strLeft;
	m_compair.m_strRight = strRight;
}

void XCompareRunnable::run()
{
	if (false == m_task->Valid())
	{
		return;
	}
	SetCompairDir(m_strLeft, m_strRight);

	auto compareData = m_compair.Compare();
	compareData.push_back(m_strLeft);
	compareData.push_back(m_strRight);

	emit sigCompairResult(compareData, m_task);
}
